package com.woniu.airent.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.woniu.airent.utils.JsonTest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * description:
 *
 * @author AlenHx
 * @create 2020/9/27
 * @since 1.0.0
 */

@Controller
public class CityController {

    //读取json文件传到前台
    @RequestMapping("/cityData")
    @ResponseBody
    public JSONArray cityData(){
        String path = JsonTest.class.getClassLoader().getResource("city.json").getPath();
        String s = JsonTest.readJsonFile(path);
        JSONArray jsonArray = JSON.parseArray(s);
        return jsonArray;
    }



}
